package org.example.system.dubbo;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.example.api.system.RemoteTenantService;
import org.example.api.system.domain.vo.RemoteTenantVo;
import org.example.common.core.utils.MapstructUtils;
import org.example.common.core.utils.page.Pager;
import org.example.system.domain.vo.SysTenantVo;
import org.example.system.service.ISysTenantService;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
@DubboService
@RequiredArgsConstructor
public class RemoteTenantServiceImpl implements RemoteTenantService {

    private final ISysTenantService tenantService;

    @Override
    public List<RemoteTenantVo> queryList() {
        List<SysTenantVo> list = tenantService.queryList(new Pager());
        return MapstructUtils.convert(list, RemoteTenantVo.class);
    }

    @Override
    public RemoteTenantVo queryByTenantId(String tenantId) {
        SysTenantVo tenantVo=tenantService.queryByTenantId(tenantId);
        return MapstructUtils.convert(tenantVo,RemoteTenantVo.class);
    }
}
